﻿using IBLL;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Model.DTO;
using Model;

namespace API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class HouseTypeController : ControllerBase
    {
        public HouseTypeController(HouseTypeIBLL Db)
        {
            this.Db = Db;
        }

        public HouseTypeIBLL Db { get; }
        [HttpPost]
        public async Task<int> Add(HouseType d)
        {
            return await Db.Add(d);
        }
        [HttpGet]
        public HouseTypeDTO Show(string? name, double? min, double? max, int pageIndex, int pageSize)
        {
            return  Db.Show (name, min, max,pageIndex, pageSize);
        }
        [HttpGet]
        public IQueryable<HouseType> ShowAll()
        {
            return Db.ShowAll();
        }
    }
}
